﻿#pragma once

#include "cat.hpp"
#include "cat-interaction.hpp"

#ifdef __cplusplus
extern "C" {
#endif

	enum cat_source_type {
		CAT_SOURCE_TYPE_MODE,
		CAT_SOURCE_TYPE_INPUT,
		CAT_SOURCE_TYPE_OUTPUT,
		CAT_SOURCE_TYPE_UI
	};

	struct cat_source_info {
		int id;

		enum cat_source_type type;

		const char* (*get_name)();

		const char* (*get_default_config_name)();

		void* (*Init)(cat_data_t* settings);

		void* (*Update)(cat_data_t* settings);

		void* (*Release)();
		
		void* (*Run)(void* _window);

		void* (*Tick)(float time_in_sec);

		void* (*OnKeyPress)(const cat_key_event* event, bool key_up);

		void* (*OnMouseClick)(const cat_mouse_click_event* event, bool mouse_up);
		/// <summary>
		/// 鼠标在屏幕的坐标
		/// </summary>
		void* (*OnMouseMove)(const cat_mouse_move_event* event);
		/// <summary>
		/// 鼠标相对移动距离
		/// </summary>
		void* (*OnForceMouseMove)(const cat_mouse_move_event* event);
		
		/// <summary>
		/// 手柄点击
		/// </summary>
		void* (*OnJoystickButtonPress)(const cat_joystick_button_event* event, bool);

		/// <summary>
		/// 手柄摇杆移动
		/// </summary>
		void* (*OnjoystickAxisMove)(const cat_joystick_axis_move_event* event);

		/// <summary>
		/// 高级开发使用
		/// </summary>
		void* (*OpenMenu)();
	};

	EXPORT void cat_register_source_s(const struct cat_source_info* info,
		size_t size);


#define cat_register_source(info) \
	cat_register_source_s(info, sizeof(struct cat_source_info))




#ifdef __cplusplus
}
#endif
